// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

import request from '@/utils/request'

/**
 * 获取微信发货配置
 */
export function getWechatShippingConfigApi() {
  return new Promise((resolve) => {
    // 暂时返回模拟数据
    setTimeout(() => {
      resolve({
        data: {
          enabled: false,
          autoUpload: true,
          specialMode: 1,
          retryTimes: 3,
          retryInterval: 30
        }
      })
    }, 500)
  })
  
  // 真实API调用（后端完成后启用）
  /*
  return request({
    url: '/admin/wechat/shipping/config',
    method: 'get'
  })
  */
}

/**
 * 更新微信发货配置
 */
export function updateWechatShippingConfigApi(data) {
  return new Promise((resolve) => {
    // 暂时返回成功
    setTimeout(() => {
      console.log('模拟保存配置:', data)
      resolve({ data: 'success' })
    }, 1000)
  })
  
  // 真实API调用（后端完成后启用）
  /*
  return request({
    url: '/admin/wechat/shipping/config',
    method: 'post',
    data
  })
  */
}

/**
 * 查询微信发货状态
 * @param params
 */
export function getWechatShippingStatusApi(params) {
  return request({
    url: '/admin/wechat/shipping/status',
    method: 'get',
    params
  })
}

/**
 * 特殊发货报备
 * @param params
 */
export function specialOrderReportApi(params) {
  return request({
    url: '/admin/wechat/shipping/special',
    method: 'post',
    params
  })
}

/**
 * 重试上传发货信息
 * @param params
 */
export function retryUploadShippingApi(params) {
  return request({
    url: '/admin/wechat/shipping/retry',
    method: 'post',
    params
  })
}

/**
 * 检查微信发货功能是否启用
 */
export function isWechatShippingEnabledApi() {
  return request({
    url: '/admin/wechat/shipping/enabled',
    method: 'get'
  })
}

/**
 * 手动上传微信发货信息
 */
export function uploadWechatShippingInfoApi(orderNo) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({ data: 'success' })
    }, 1000)
  })
  
  // 真实API调用（后端完成后启用）
  /*
  return request({
    url: '/admin/wechat/shipping/upload',
    method: 'post',
    params: { orderNo }
  })
  */
} 